// 备件采购订单
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 通用-订单上传
export const uploadOrder = params => axios.get(`${SERVER.DMSCLOUD_PART}/order/orderUpload`, { params, timeout: 60000 });
// 通用-查询备件年化出库信息
export const queryPartMonthReport = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getMonthReport`, { params });
// 通用-锁定订单（防止两人同时编辑）
export const lockOrderForEdit = itemId => axios.put(`${SERVER.DMSCLOUD_PART}/stockmanage/partbuy/addLocalUser/${itemId}`);
// 通用-解锁订单
export const unlockOrderForEdit = itemId => axios.put(`${SERVER.DMSCLOUD_PART}/stockmanage/partbuy/delLocalUser/${itemId}`);
// 通用-查询订单是否被他人锁定
export const queryOrderIsLocked = itemId => axios.get(`${SERVER.DMSCLOUD_PART}/stockmanage/partbuy/searchLocalUser/${itemId}`);

// 主页-获取订单列表
export const queryOrderList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getPageList`, { params });
// 主页-etka接收备件查询
export const queryEtkaParts = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getEtkaList`, { params });
// 主页-查询订单执行情况（本地）
export const queryOrderExecuteStatus = params => axios.get(`${SERVER.SEARCH_DMSCLOUD_PART}/partPurchase/getOrderExecuteCondition`, { params });
// 主页-查询订单执行情况（实时）
export const queryOrderExecuteStatusRealTime = params => axios.get(`${SERVER.SEARCH_DMSCLOUD_PART}/partPurchase/getOrderExecuteCondition`, { params });
// 主页-查看R3日志
export const quertR3Log = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getR3Log`, { params });
// 主页-etka接收备件删除
export const deleteEtkaParts = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/deleteEtka`, params);
// 主页-订单执行情况查询发货单打印数据查询
export const queryDispatchPrintData = params => axios.get(`${SERVER.SEARCH_DMSCLOUD_PART}/partPurchase/getOrderExecuteCondition`, { params });
// 主页-订单执行情况查询申请单打印数据查询
export const queryRequestNotePrint = params => axios.get(`${SERVER.SEARCH_DMSCLOUD_PART}/partPurchase/getOrderExecuteCondition`, { params });
// 主页-处理过期订单
export const dealOverdueOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/dealOutdateOrder`, params);

// 新建-根据订单类型查询备件列表
export const queryPartListByOrderType = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getPartList`, { params, timeout: 60000 });
// 新建-查询所有订单类型
export const queryAllOrderTypeInfo = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getCheckRule`, { params });
// 新建-查询所有单据类型
export const queryAllBillsType = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getOrderType`, { params });
// 新建-根据单据类型查询单据
export const queryBllsByType = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getOrderTypeList`, { params });
// 新建-根据选择单据查询单据详情
export const queryBllDetailById = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getOrderListByBillNo`, { params });
// 新建-保存订单
export const saveNewOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/createPartPurchaseOrder`, params);
// 新建-查询打包备件
export const queryPackingParts = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getPackageList`, { params });
// 新建-获取套餐列表
export const querySetMealList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getPartSetList`, { params });
// 新建-查询车辆信息(vin输入)
export const queryCarListByVinAndLicence = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getVin`, { params });
// 新建-批量订货列表
export const queryBatchOrderPartList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/batchOrder`, { params });
// 新增-资金预测-获取预测金额信息
export const fundForecast = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getAmountPlan`, { params });
// 新增-资金预测-获取备件信息
export const fundForecastPartList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getAmountPlanItem`, { params });
// 新建-获取推式建议
export const queryPushSuggestion = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/pushSuggestion`, { params, timeout: 60000 });
// 新建-同步备件主文件
export const syncPartMainFile = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/synchroPartInfo`, { params });
// 新建=修改订单状态
export const updateOrderStatus = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/updateOrderStatus`, params);
// 新建-查询采购计划单类型的单据列表
export const queryPlanOrderList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getOrderPlanList`, { params });
// 新建-根据采购计划单id查询采购计划单明细
export const queryPlanOrderDetailById = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getOrderPlanItemList`, { params });
// 新建-查询欠料单类型的单据列表(直接是明细)
export const queryDefaultOrderList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getDebtList`, { params });
// 新建-查询借入单类型的单据列表
export const queryBorrowOrderList = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getBroowerList`, { params });
// 新建-根据借入单id查询欠料单明细
export const queryBorrowOrderDetailById = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getBroowerItemList`, { params });
// 新建-校验订单是否能够拆分
export const checkOrderNeedSplit = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/isPartOrderSplit`, params);
// 新建-保存拆分订单
export const saveSplitOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/splitPartPurchaseOrder`, params);
// 新建-根据套餐号查询套餐明细列表
export const querySetMealPartListByTcCode = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getPartSetItemList`, { params });
// 新建-导出导入模板
export const exportTemplate = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/export`, { params, responseType: 'blob' });
// 新建-根据vin码查询委托书记录（赋值委托书号，送修日期）
export const queryOrderInfoByVin = params => axios.get(`${SERVER.DMSCLOUD_PART}/stockmanage/partbuy/searchRepairOrderByVIN`, { params });

// 编辑-根据订单id查询订单详情
export const queryOrderInforByNo = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getOrderById`, { params });
// 编辑-编辑订单保存
export const updateOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/modifyPartPurchaseOrder`, params);
// 编辑-查询订单备件详情
export const queryOrderPartDetailByOrderNo = params => axios.get(`${SERVER.DMSCLOUD_PART}/partPurchase/getPartListByOrderNo`, { params, timeout: 60000 });
// 编辑-锁定订单
export const lockOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/lockOrder`, params);
// 编辑-解锁订单
export const unLockOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/unlockOrder`, params);
// 编辑-删除整个订单
export const deleteOrder = params => axios.post(`${SERVER.DMSCLOUD_PART}/partPurchase/deleteOrder`, params);
